
/**
 * @version $Id$
 * @create 2013-8-15 16:46:18 By xjiujiu
 * @description HongJuZi Framework
 * @copyRight Copyright (c) 2011-2012 http://www.xjiujiu.com.All right reserved
 */

(function($) {
    var HBrand     = {
        init: function() {
            this.bindBrandLikeBtn();
            this.bindGoodsLikeBtn();
			this.bindFathersdayLikeBtn();
        },
        bindGoodsLikeBtn: function() {
            $(".goods a.total-like, .goods a.big-total-like").click(function() {
                var id      = $(this).attr('id');
                var $self   = $(this);
                $.getJSON(
                    siteUrl + "/index.php/goods/alike",
                    {id: id},
                    function(data) {
                        if(data.rs == false) {
                            alert(data.info);
							$('.login-dialog-btn').click();
                            return false;
                        }
                        $self.html(data.total);
                    }
                );
            });
        },
		 bindFathersdayLikeBtn: function() {
            $(".fathersday a.total-like, .fathersday a.big-total-like").click(function() {				
                var id      = $(this).attr('id');
                var $self   = $(this);
                $.getJSON(
                    siteUrl + "/index.php/fathersday/alike",
                    {id: id},
                    function(data) {
                        if(data.rs == false) {
                            alert(data.info);
                            return false;
                        }
                        $self.html(data.total);
                    }
                );
            });
        },
        bindBrandLikeBtn: function() {
            $(".brand a.total-like, .brand a.big-total-like").click(function() {
                var id      = $(this).attr('id');
                var $self   = $(this);
                $.getJSON(
                    siteUrl + "/index.php/brand/alike",
                    {id: id},
                    function(data) {
                        if(data.rs == false) {
                            alert(data.info);
                            return false;
                        }
                        $self.html(data.total);
                    }
                );
            });
        }
    };
    //初始化事件
    HHJsLib.register(HBrand, HBrand.init, 'init');
})(jQuery);
